package botcraft.game.xml;

import java.util.logging.Level;
import java.util.logging.Logger;

import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;

public class BotcraftErrorHandler implements ErrorHandler {
	private static final Logger LOGGER = Logger.getLogger(BotcraftErrorHandler.class.getName());
	
	@Override
	public void error(final SAXParseException e) throws SAXException {
		LOGGER.log(Level.SEVERE, "Error while parsing XML", e);
		throw e;
	}

	@Override
	public void fatalError(final SAXParseException e) throws SAXException {
		LOGGER.log(Level.SEVERE, "Fatal error while parsing XML", e);
		throw e;
	}

	@Override
	public void warning(final SAXParseException e) throws SAXException {
		LOGGER.log(Level.WARNING, "Warning while parsing XML", e);
	}
}
